﻿@page
@model Shopping.Web.Pages.OrderListModel
@{
    ViewData["Title"] = "Order";
}

<div class="container">
    <div class="row">
        <div class="col">
            <nav aria-label="breadcrumb">
                <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a asp-page="Index">Home</a></li>
                    <li class="breadcrumb-item active" aria-current="page">Order</li>
                </ol>
            </nav>
        </div>
    </div>
</div>

<div class="container mb-4">
    <div class="row">
        <div class="col-12">
            <div class="table-responsive">
                <table class="table table-striped">
                    <thead>
                        <tr>
                            <th scope="col"> </th>
                            <th scope="col">Order Name</th>
                            <th scope="col">First Name</th>
                            <th scope="col">Last Name</th>
                            <th scope="col">Email</th>
                            <th scope="col">AddressLine</th>
                            <th scope="col">CardName</th>
                            <th scope="col">OrderStatus</th>
                            <th scope="col" class="text-right">TotalPrice</th>
                        </tr>
                    </thead>
                    <tbody>

                        @foreach (var order in Model.Orders)
                        {
                            <tr>
                                <td><img src="https://dummyimage.com/50x50/55595c/fff" /></td>
                                <td>@order.OrderName</td>
                                <td>@order.ShippingAddress.FirstName</td>
                                <td>@order.ShippingAddress.LastName</td>
                                <td>@order.ShippingAddress.EmailAddress</td>
                                <td>@order.ShippingAddress.AddressLine</td>
                                <td>@order.Payment.CardName</td>
                                <td>@order.Status</td>
                                <td class="text-right">@order.OrderItems.Sum(x => x.Price * x.Quantity) $</td>
                            </tr>
                        }
                    </tbody>
                </table>
            </div>
        </div>
        <div class="col mb-2">
            <div class="row">
                <div class="col-sm-12  col-md-6">
                    <a asp-page="Product" class="btn btn-lg btn-block btn-success">Continue Shopping</a>
                </div>
            </div>
        </div>
    </div>
</div>

